Added test
authorFabien Antoine <fab.antoine@gmail.com>
Sat, 6 May 2017 12:44:41 +0000 (14:44 +0200)
committerFabien Antoine <fab.antoine@gmail.com>
Sat, 6 May 2017 12:44:41 +0000 (14:44 +0200)
tests/git.rs

index 5b4ae50593ad9363fd6022e64bb7ac233c1063f9..07c4996cb4225e480dff0ec6d72a651f1d64f5e0 100644 (file)
@@ -290,6 +290,61 @@ fn cargo_compile_with_nested_paths() {
                 execs().with_stdout("hello world\n"));
 }
 
+#[test]
+fn cargo_compile_with_malformed_nested_paths() {
+    let git_project = git::new("dep1", |project| {
+        project
+            .file("Cargo.toml", r#"
+                [project]
+
+                name = "dep1"
+                version = "0.5.0"
+                authors = ["carlhuda@example.com"]
+
+                [lib]
+
+                name = "dep1"
+            "#)
+            .file("src/dep1.rs", r#"
+                pub fn hello() -> &'static str {
+                    "hello world"
+                }
+            "#)
+            .file("vendor/dep2/Cargo.toml", r#"
+                !INVALID!
+            "#)
+    }).unwrap();
+
+    let p = project("parent")
+        .file("Cargo.toml", &format!(r#"
+            [project]
+
+            name = "parent"
+            version = "0.5.0"
+            authors = ["wycats@example.com"]
+
+            [dependencies.dep1]
+
+            version = "0.5.0"
+            git = '{}'
+
+            [[bin]]
+
+            name = "parent"
+        "#, git_project.url()))
+        .file("src/parent.rs",
+              &main_file(r#""{}", dep1::hello()"#, &["dep1"]));
+
+    p.cargo_process("build")
+        .exec_with_output()
+        .unwrap();
+
+    assert_that(&p.bin("parent"), existing_file());
+
+    assert_that(process(&p.bin("parent")),
+                execs().with_stdout("hello world\n"));
+}
+
 #[test]
 fn cargo_compile_with_meta_package() {
     let git_project = git::new("meta-dep", |project| {